<template>
<div>
    <button @click="yyds">子组件按键</button>
    <p v-show="hidden">这里是儿子组件</p>
</div>
</template>

<script lang="ts" setup>
import { onMounted, ref } from 'vue';

onMounted(()=>{
})
const text = ref('父亲大人安好！！')
const hidden = ref(true)
const saytofather = ()=>{
    console.log('父亲大人安好');
    
}
const yyds = ()=>{
    hidden.value = !hidden.value
}
//通过definExpose把子组件的东西暴漏出去！！！以便父组件能接收
//子组件definexpose暴漏，父组件ref接收
defineExpose({
    hidden,
    text,
    saytofather
})
</script>

<style lang="less" scoped>
</style>